import React from 'react';
import { Button,Space, Table } from 'antd';
import type { ColumnsType } from 'antd/es/table';
import { Link } from 'react-router-dom'
import './Purpose.css';

interface DataType {
  key: string;
  name: string;
  remark: string;
}
const update = (data: DataType) => {
  console.log(data)
};
const columns: ColumnsType<DataType> = [
  {
    title: '名称',
    dataIndex: 'name',
    key: 'name',
  },
  {
    title: '备注',
    dataIndex: 'remark',
    key: 'remark',
  },
  {
    title: '操作',
    key: 'action',
    render: (_, record) => (
      <Space size="middle">
        <Button onClick={() => update(record)}>编辑</Button>
      </Space>
    ),
  },
];

const data: DataType[] = [
  {
    key: '1',
    name: 'John Brown',
    remark: 'New York No. 1 Lake Park',
  },
  {
    key: '2',
    name: 'Jim Green',
    remark: 'London No. 1 Lake Park',
  },
  {
    key: '3',
    name: 'Joe Black',
    remark: 'Sydney No. 1 Lake Park',
  },
];

const Purpose: React.FC = () => (
  <div>
    <div className='flex-between'>
      <h1>金钱用途列表</h1>
      <Link to="/">
        返回首页
      </Link>
    </div>
    <Table columns={columns} dataSource={data} />
  </div>

)
export default Purpose;